
***************************************
*          @@  FLEX 3 @@              *                  
*                                     *
*   ------ >> Chapitre 9 << ------    *
*                                     *
***************************************


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	
	<!-- GROUPE DE BOUTONS RADIO !-->
	<mx:RadioButtonGroup id="radioBoutons"/>
	<mx:RadioButton x="34" y="21" label="Recherche simple" groupName="radioBoutons" id="btn_simple" selected="true"/>
	<mx:RadioButton x="166" y="21" label="Recherche avance" groupName="radioBoutons" id="btn_avance"/>
		
	<!-- CRITRES DE RECHERCHE !-->
	<mx:Panel id="panel1" x="34" y="51" width="339" height="198" layout="absolute" title="Critres de recherche" >
	    <mx:Form id="form1" x="10" y="10" height="108" width="302" horizontalScrollPolicy="off" verticalScrollPolicy="off">
	        <mx:FormItem label="N patient :">
	            <mx:TextInput id="numPatient"/>
	        </mx:FormItem>
	        <mx:FormItem label="Prnom :">
	            <mx:TextInput id="Prenom"/>
	        </mx:FormItem>
	        <mx:FormItem label="Nom :">
	            <mx:TextInput id="Nom"/>
	        </mx:FormItem>
	    </mx:Form>
	    <mx:Button id="button1" x="221" y="126" label="Rechercher"/>
	</mx:Panel>
	
</mx:Application>
	<mx:states>
	    <mx:State name="rechercheAvancee"/>
	</mx:states>
<mx:states>
	    <mx:State name="rechercheAvancee">
	        <mx:SetProperty target="{panel1}" name="height" value="267"/>
	        <mx:SetProperty target="{button1}" name="x" value="218"/>
	        <mx:SetProperty target="{button1}" name="y" value="195"/>
	        <mx:SetProperty target="{form1}" name="height" value="177"/>
	        <mx:AddChild relativeTo="{form1}" position="lastChild">
	            <mx:FormItem label="N chambre :">
	                <mx:TextInput id="num_chambre"/>
	            </mx:FormItem>
	        </mx:AddChild>
	        <mx:AddChild relativeTo="{form1}" position="lastChild">
	            <mx:FormItem label="Date admission :">
	                <mx:DateField id="dateAdmission" />
	            </mx:FormItem>
	        </mx:AddChild>
	    </mx:State>
	</mx:states>
<mx:AddChild relativeTo="{form1}" position="lastChild">
	    <mx:FormItem label="N chambre :">
	        <mx:TextInput id="num_chambre"/>
	    </mx:FormItem>
	</mx:AddChild>
	<mx:AddChild relativeTo="{form1}" position="lastChild">
	    <mx:FormItem label="Date admission :">
	        <mx:DateField id="dateAdmission" />
	    </mx:FormItem>
	</mx:AddChild>
	<!-- GROUPE DE BOUTONS RADIO!-->
	<mx:RadioButtonGroup id="radioBoutons"/>
	<mx:RadioButton x="34" y="21" label="Recherche simple" groupName="radioBoutons" id="btn_simple" selected="true" click="currentState=''"/>
	<mx:RadioButton x="166" y="21" label="Recherche avance" groupName="radioBoutons" id="btn_avance" click="currentState='rechercheAvancee'"/>
<mx:SetEventHandler target="{btn_simple}" name="click" handler="currentState=''"/>
	    <mx:SetEventHandler target="{btn_avance}" name="click" handler="currentState='rechercheAvancee'"/>
<mx:State name="rechercheAvancee">
	    <mx:SetProperty target="{panel1}" name="height" value="267"/>
	    <mx:SetProperty target="{button1}" name="x" value="218"/>
	    <mx:SetProperty target="{button1}" name="y" value="195"/>
	    <mx:SetProperty target="{form1}" name="height" value="177"/>
	    <mx:AddChild relativeTo="{form1}" position="lastChild">
	        <mx:FormItem label="N chambre :">
	            <mx:TextInput id="num_chambre"/>
	        </mx:FormItem>
	    </mx:AddChild>
	    <mx:AddChild relativeTo="{form1}" position="lastChild">
	        <mx:FormItem label="Date admission :">
	            <mx:DateField id="dateAdmission"/>
	        </mx:FormItem>
	    </mx:AddChild>
	    <mx:SetEventHandler target="{btn_simple}" name="click" handler="currentState=''"/>
	    <mx:SetEventHandler target="{btn_avance}" name="click" handler="currentState='rechercheAvancee'"/>
	</mx:State>
<mx:transitions>
	<mx:Transition id="transition" fromState="*" toState="*">
	    <mx:WipeDown duration="1000" target="{panel1}"> </mx:WipeDown>
	</mx:Transition>
</mx:transitions>
<mx:transitions>
	<mx:Transition id="transition" fromState="*" toState="*">
	    <mx:WipeDown duration="1000" target="{panel1}"> </mx:WipeDown>
	</mx:Transition>
</mx:transitions>
<mx:WipeDown duration="1000" targets="{[panel1,numPatient]}"> </mx:WipeDown>
<mx:transitions>
	<mx:Transition id="transition" fromState="*" toState="*">
	    <mx:Sequence target="{panel1}">
	        <mx:WipeDown duration="1000"> </mx:WipeDown>
	        <mx:Blur duration="1500"> </mx:Blur>
	    </mx:Sequence>
	</mx:Transition>
</mx:transitions>
<mx:transitions>
	<mx:Transition id="transition" fromState="*" toState="*">
	    <mx:Parallel target="{panel1}">
	        <mx:WipeDown duration="1000"> </mx:WipeDown>
	        <mx:Blur duration="1500"> </mx:Blur>
	    </mx:Parallel>
	</mx:Transition>
</mx:transitions>
<!-- TRANSITIONS !-->
	<mx:transitions>
	    <mx:Transition id="transition" fromState="*" toState="*">
	        <mx:Parallel target="{panel1}">
	            <mx:Rotate angleFrom="0" angleTo="360" duration="1000"> </mx:Rotate>
	            <mx:Iris duration="1000"> </mx:Iris>
	        </mx:Parallel>
	    </mx:Transition>
	</mx:transitions>
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	
	<!-- TRANSITIONS !-->
	<mx:transitions>
	    <mx:Transition id="transition" fromState="*" toState="*">
	        <mx:Parallel target="{panel1}">
	            <mx:Rotate angleFrom="0" angleTo="360" duration="1000"> </mx:Rotate>
	            <mx:Iris duration="1000"> </mx:Iris>
	        </mx:Parallel>
	    </mx:Transition>
	</mx:transitions>
		
	<!-- GROUPE DE BOUTONS RADIO!-->
	<mx:RadioButtonGroup id="radioBoutons"/>
	<mx:RadioButton x="34" y="21" label="Recherche simple" groupName="radioBoutons" id="btn_simple" selected="true" click="currentState=''"/>
	<mx:RadioButton x="166" y="21" label="Recherche avance" groupName="radioBoutons" id="btn_avance" click="currentState='rechercheAvancee'"/>
		
	<!-- CRITRES DE RECHERCHE !-->
	<mx:Panel x="34" y="51" width="339" height="198" layout="absolute" title="Critres de recherche" id="panel1">
	    <mx:Form x="10" y="10" height="108" width="302" horizontalScrollPolicy="off" verticalScrollPolicy="off" id="form1">
	        <mx:FormItem label="N patient :">
	            <mx:TextInput id="numPatient"/>
	        </mx:FormItem>
	        <mx:FormItem label="Prnom :">
	            <mx:TextInput id="Prenom"/>
	        </mx:FormItem>
	        <mx:FormItem label="Nom :">
	            <mx:TextInput id="Nom"/>
	        </mx:FormItem>
	    </mx:Form>
	    <mx:Button x="221" y="126" label="Rechercher" id="button1"/>
	</mx:Panel>
	

	<!-- TATS !-->
	<mx:states>
	    <mx:State name="rechercheAvancee">
	        <mx:SetProperty target="{panel1}" name="height" value="267"/>
	        <mx:SetProperty target="{button1}" name="x" value="218"/>
	        <mx:SetProperty target="{button1}" name="y" value="195"/>
	        <mx:SetProperty target="{form1}" name="height" value="177"/>
	        <mx:AddChild relativeTo="{form1}" position="lastChild">
	            <mx:FormItem label="N chambre :">
	                <mx:TextInput id="num_chambre"/>
	            </mx:FormItem>
	        </mx:AddChild>
	        <mx:AddChild relativeTo="{form1}" position="lastChild">
	            <mx:FormItem label="Date admission :">
	                <mx:DateField id="dateAdmission"/>
	            </mx:FormItem>
	        </mx:AddChild>
	        <mx:SetEventHandler target="{btn_simple}" name="click" handler="currentState=''"/>
	        <mx:SetEventHandler target="{btn_avance}" name="click" handler="currentState='rechercheAvancee'"/>
	    </mx:State>
	</mx:states>
		
</mx:Application>
<!-- TRANSITIONS !-->
	<mx:transitions>
	    <mx:Transition id="transition" fromState="*" toState="*">
	        <mx:Parallel target="{panel1}">
	            <mx:Rotate angleFrom="0" angleTo="360" duration="1000"> </mx:Rotate>
	            <mx:Iris duration="1000"> </mx:Iris>
	        </mx:Parallel>
	    </mx:Transition>
	</mx:transitions>
<mx:Script source="TransitionAS3.as"> </mx:Script>
// Importation des classes ncessaires
import mx.effects.Iris;
import mx.effects.Parallel;
import mx.effects.Rotate;
import mx.states.Transition;

public function creationTransition ():void{
		
	// Cration de la transition
	var transitionAS:Transition = new Transition;
	transitionAS.fromState = "*";
	transitionAS.toState = "*";
	
	// Cration de la notion de paralllisme deffets
	var parallelisme:Parallel = new Parallel;
	parallelisme.target = panel1;
	
	// Cration de leffet de rotation
	var rotation:Rotate = new Rotate();
	rotation.angleFrom = 0;
	rotation.angleTo = 360
	rotation.duration = 1000;

	// Cration de leffet dIris
	var iris:Iris = new Iris();
	iris.duration = 1000;
	
	// Ajout des effets au conteneur deffets
	parallelisme.addChild(rotation);
	parallelisme.addChild(iris);
	
	// Ajout du conteneur  la transition
	transitionAS.effect = parallelisme;
	
	// Ajout de la transition  la balise <mx:transitions> de lapplication
	application.transitions = [transitionAS];
}
<mx:Parallel target="{panel1}">
	    <mx:Rotate angleFrom="0" angleTo="360" duration="1000"> </mx:Rotate>
	    <mx:Iris duration="1000"> </mx:Iris>
	</mx:Parallel>
// Llment B est contenu dans llment A
<ElementA>
	    <ElementB> </ElementB>
</ElementA>
parallelisme.addChild(rotation);
	parallelisme.addChild(iris);
application.transitions = [transitionAS];
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationTransition ()">
